FileClose

 

The 'FileClose' function closes a file.

 

void FileClose(DWORD handle);

 

Note : After you finish your use of the file or the print port, you must always close the file or the print port. In other words, after you use the 'FileOpen' function or the ' FileOpenLPT' function, you must always use the 'FileClose' function.

 

Parameters
DWORD handle : 'Return Value' of the 'FileOpen' function or the 'FileOpenLPT' function

 

Return Value

none

 

Example 1

handle = @FileOpen("C:\\EX.TXT", "a");

if(handle != 0)

{

@FileWrite(handle, "example data", 12);

@FileClose(handle);

}

Description : The first line is to open the file named 'EX.TXT' in C drive. If the file is opened, 'example data' is written to the file. Afterward, the file is closed by the '@FileClose(handle);'.

 

Example 2

handle = @FileOpen("C:\\EX.TXT", "r");

if(handle != 0)

{

@FileRead(handle, buf, 12);

@FileClose(handle);

}

Description : The first line is to open the file named 'EX.TXT' in C drive. If the file is opened, twelve data of the file is stored in the variable named 'buf'. Afterward, the file is closed by the '@FileClose(handle);'.